<template>
  <div class="modal-form-container">
    <vuescroll :ops="ops">
      <Form ref="info" :model="data" :label-width="100">
        <FormItem :label="$t('yacjguB_IxMceP1QpX80j')">
          <Input v-model="data.phoneNumber" />
        </FormItem>
        <FormItem :label="$t('xPwJJXElH7uH9fYpuGhBU')">
          <Input v-model="data.phoneOwnerName" />
        </FormItem>
        <FormItem :label="$t('IjIPS4LeBCiI7e3iPsTn6')">
          <Input v-model="data.LicensePlateNumber" />
        </FormItem>
        <FormItem :label="$t('roFLXyzn30j8fhMvZjJjW')">
          <Input v-model="data.firstLoadTime" />
        </FormItem>
        <FormItem :label="$t('eyENjg4PDnj6Ss-_pCAFC')">
          <Input v-model="data.loveBusType" />
        </FormItem>
        <FormItem :label="$t('a-LXwsl7nkF5v_u7gORNm')">
          <Input v-model="data.pwd" />
        </FormItem>
        <FormItem :label="$t('KMQM5FX8_E2lF4sgDZ1x5')">
          <Select v-model="data.userStatus">
            <Option value="0">禁用</Option>
            <Option value="1">正常</Option>
          </Select>
        </FormItem>
        <FormItem>
          <Button type="primary" @click="save">{{$t('q-FETLOZVSMbWnrNq0vj6')}}</Button>
          <Button style="margin-left: 8px" @click="close">{{$t('2LFpg56tAgKyBB40xpv5l')}}</Button>
        </FormItem>
      </Form>
    </vuescroll>
  </div>
</template>

<script>
import vuescroll from 'vuescroll'
import { setFormData } from '@/api/data2'

export default {
  name: 'app_user_manage_form_info',
  components: {
    vuescroll
  },
  props: {
    data: Object
  },
  data () {
    return {
      ops: {
        scrollPanel: {
          maxHeight: 500
        }
      }
    }
  },
  methods: {
    close () {
      this.$emit('close')
    },
    async save () {
      const formData = new FormData()
      for (const key in this.data) {
        formData.append(key, this.data[key])
      }
      const res = await setFormData(formData)
      if (res.status === 200) {
        this.$emit('success', _.cloneDeep(this.data))
      } else {
        this.$emit('fail')
      }
    }
  }
}
</script>
